<template>
    <div class="detail-container cfmatchbid-detail">
        <div class="bidtitle"><p class="bidtitle-wrap">{{bidDetail.bidName}}</p></div>
        <div class="detail-content">
            <div class="content-list">
                <div class="title">借款人</div>
                <div class="info">{{bidDetail.lenderName}}</div>
            </div>
            <div class="content-list">
                <div class="title">证件号码</div>
                <div class="info">{{bidDetail.certificateNo}}</div>
            </div>
            <div class="content-list">
                <div class="title">借款金额</div>
                <div class="info">{{bidDetail.loanAmount}}</div>
            </div>
            <div class="content-list">
                <div class="title">借款用途</div>
                <div class="info">{{bidDetail.loanPurpose}}</div>
            </div>
            <p class="agreement" v-if="bidDetail.agreements && bidDetail.agreements.length > 0">相关协议请去App查看</p>
        </div>
        <div class="detail-return-money">
            <matchBidDetail :bidDetail="bidDetail" />
        </div>
    </div>
</template>
<script>
  import axios from '~/plugins/axios'
  import {Toast, Indicator} from 'mint-ui'
  import matchBidDetail from '../../../components/investDetail/matchbid-repaymentplans'
  export default {
    middleware: 'auth',
    data () {
      return {
        bidDetail: {}
      }
    },
    components: {
      matchBidDetail
    },
    mounted () {
      console.log(this.$route.params)
      if (this.$route.params && this.$route.params.id) {
        Indicator.open()
        const datas = {bidRecordId: this.$route.params.id}
        axios.post('/api/matchedbiddetail', datas).then((resp) => {
          Indicator.close()
          console.log(resp.data)
          if (resp && resp.data && resp.data.status === 0) {
            this.bidDetail = resp.data.body
          } else {
            Toast(resp.data.message || resp.data.responseMessage)
          }
        }).catch(errors => {
          Indicator.close()
          Toast('接口异常')
        })
      }
    }
  }
</script>
<style lang='sass' src='~/assets/sass/biddetail.sass'></style>